package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("note.txt",true);
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw= new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner scanner =new Scanner(System.in);
        while (true){
            System.out.println("请输入内容，单独输入exist退出：");
            String str = scanner.nextLine();
            if (str.equalsIgnoreCase("exist")){
                break;
            }
            pw.println(str);
            //
        }
        System.out.println("再见");
        pw.close();
    }
}
